import 'package:flutter/material.dart';
import 'package:flutter_juwo/common/common_index.dart';
import 'package:flutter_juwo/ui/utils/utils.dart';

class UserInfor extends StatefulWidget {
  @override
  _UserInforState createState() => _UserInforState();
}

class _UserInforState extends State<UserInfor> {
  List datas = [
    {"name": "基本信息", "status": 0, "infor": ""},
    {"name": "实名认证", "status": 0, "infor": ""},
    {"name": "银行卡认证", "status": 0, "infor": ""},
    {"name": "绑定电商账号", "status": 0, "infor": ""},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colours.c243,
      appBar: UiUtils.appBar(context, "我的认证"),
      body: Column(
        children: <Widget>[
          UiUtils.dividerWidget(ScreenUtil().setWidth(20)),
          Expanded(
            flex: 1,
            child: EasyRefresh(
                child: ListView.builder(
                    itemCount: datas.length,
                    itemBuilder: (BuildContext context, int index) {
                      return getItem(datas[index]);
                    })),
          )
        ],
      ),
    );
  }

  Widget getItem(data) {
    return Container(
      child: Column(
        children: <Widget>[
          GestureDetector(
            onTap: () {
             if (data["name"] == "银行卡认证") {
                Application.router.navigateTo(context, Routes.initBankCard);
              }else if (data["name"] == "绑定电商账号") {
              //  Application.router.navigateTo(context, Routes.taoList);
              }
            },
            child: Container(
              padding: EdgeInsets.fromLTRB(
                  ScreenUtil().setWidth(30), 0, ScreenUtil().setWidth(30), 0),
              color: Colors.white,
              height: ScreenUtil().setWidth(100),
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Text(
                      data["name"],
                      style: TextStyles.custom(
                          28, Colours.appC1, Font.PingFangBlod),
                    ),
                  ),
                  Text(
                    data["status"] == 0 ? "去绑定" : data["infor"],
                    style: TextStyles.custom(
                        28, Color(0xFFe1251b), Font.PingFangMedium),
                  ),
                  Image.asset(
                    Utils.getImgPath("icon_right"),
                    width: ScreenUtil().setWidth(24),
                    height: ScreenUtil().setWidth(24),
                  )
                ],
              ),
            ),
          ),
          UiUtils.dividerWidget(ScreenUtil().setWidth(20))
        ],
      ),
    );
  }
}
